<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="css/Bootstrap/css/bootstrap.min.css" />
		<link rel="stylesheet" type="text/css" href="css/Bootstrap/css/bootstrap-theme.min.css" />
		<link rel="stylesheet" type="text/css" href="css/all_css.css" />
		<link rel="stylesheet" type="text/css" href="lib/weui.css" />
		<link rel="stylesheet" type="text/css" href="css/weui/jquery-weui.css" />
		<link rel="stylesheet" type="text/css" href="css/gundong.css" />
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<style type="text/css">
			#startPic {
				max-width: 640px;
				min-width: 320px;
				width: 100%;
				margin: 0 auto;
			}
			
			.big_startImg {
				width: 100%;
				margin-top: 35%;
			}
			
			.little_startImg {
				width: 6%;
			}
			
			#lable_start {
				font-family: "宋体";
				font-weight: bold;
			}
			
			#little_lable {
				width: 100%;
				text-align: center;
				margin-top: -50px;
			}
			/*刷新按钮*/
			
			#shuaxinBtn {
				width: 35%;
				height: 40px;
				line-height: 40px;
				margin-top: 30px;
				font-family: "黑体";
			}
		</style>
	</head>

	<body>
		<div id="startPic">
			<img src="img/index/yjzPic.gif" class="big_startImg" />
			<div id="little_lable">
				<img src="img/taxi/loading_icon_1.gif" class="little_startImg" />
				<span id="lable_start">加载中...稍后</span>
				<a style="display: none;" id="shuaxinBtn" onclick="window.location.reload();" class="weui_btn weui_btn_primary">刷新</a>
			</div>
		</div>

		<script src="js/back_end.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/jquery-1.11.0.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/weui/jquery-weui.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/common.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/immersed.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			var k = 0;
			var clientId = ""; //手机唯一标识
			var token = ""; //(苹果)令牌
			//得到手机标识 方法
			$(document).ready(function() {
				//获取手机唯一标识
				document.addEventListener("plusready", function() {
					// 扩展API加载完毕，现在可以正常调用扩展API
					// 获取客户端标识信息
					//					setTimeout(function() {

					//					}, 1000);
					if(!localStorage.firstFlag) {
						var arr = ["已首次登陆"];
						localStorage.firstFlag = JSON.stringify(arr);
						//						clientId = plus.push.getClientInfo().clientid;
						//						token = plus.push.getClientInfo().token;
						//						sendClientId(clientId, token);
						jumpToIndex();
					} else {
						setTimeout(function() {
							clientId = plus.push.getClientInfo().clientid;
							token = plus.push.getClientInfo().token;
							//						alert(clientId);
							setTimeout("sendClientId(clientId,token)", 500);
						}, 500);
					}

				}, false);

			});

			$(function() {
//				jumpToIndex();//~~~~~~~暂时
				h = document.documentElement.clientHeight;
				$("#startPic").height(h);

				////判断是否有网络连接 (已经由传递cid取代 同时可测网络连接)
				//				if(navigator.onLine) { //正常工作
				//					setTimeout("jumpToIndex()", 5000);
				//				} else { //执行离线状态时的任务
				//				}
			});

			function jumpToIndex() {
				window.location.href = "index01.html";
			}

			function isIos() {
				var u = navigator.userAgent;
				var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
				var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
				if(isAndroid == true) {
					return 0;
				} else if(isiOS == true) {
					return 1;
				}
			}

			function sendClientId(clientId, token) {
				$.ajax({
					type: "post",
					url: Url,
					data: {
						"type": "addcid_to_user",
						"CID": clientId,
						"TOKEN": token, //令牌
						"ISIOS": isIos() //是否是IOS，（1，是，0，否）
						//
					},
					timeout: 10000,
					async: false,
					cache: false,
					dataType: "jsonp", //数据类型为jsonp
					jsonp: "callbackparam", //服务端用于接收callback调用的function名的参数  
					jsonpCallback: "jsonpCallback1",
					success: function(data) {
						console.log(data.CODE + "成功");
						if(data.CODE == "1") {
							setTimeout("jumpToIndex()", 1000);
						} else {
							$.alert("请检查您的网络设置", "提示");
							$(".little_startImg").hide();
							$("#lable_start").html("网络连接异常");
							$("#shuaxinBtn").show();
						}
					},
					error: function(data) {
						$.alert("请检查您的网络设置", "提示");
						$(".little_startImg").hide();
						$("#lable_start").html("网络连接异常");
						$("#shuaxinBtn").show();
					}
				});
			}
		</script>
	</body>

</html>